home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-15 | 4.7 KB | 176 lines | [TEXT/KAHL] |
- ///--------------------------------------------------------------------------------------
- // SpriteFrame.h
- //
- // Portions are copyright: © 1991-94 Tony Myles, All rights reserved worldwide.
- ///--------------------------------------------------------------------------------------
-
-
- #ifndef __SPRITEFRAME__
- #define __SPRITEFRAME__
-
-
- #ifndef __SWCOMMON__
- #include "SWCommonHeaders.h"
- #endif
-
- #ifndef __QDOFFSCREEN__
- #include <QDOffscreen.h>
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
-
-
- ///--------------------------------------------------------------------------------------
- // frame type definitions
- ///--------------------------------------------------------------------------------------
-
- typedef struct FrameRec FrameRec;
- typedef FrameRec *FramePtr, **FrameHdl;
-
-
- ///--------------------------------------------------------------------------------------
- // frame data structure
- ///--------------------------------------------------------------------------------------
-
- struct FrameRec
- {
- GWorldPtr framePort; // GWorld for the frame image
- PixMapHandle framePixHndl; // handle to pix map (saved for unlocking/locking)
- PixMapPtr framePix; // pointer color pix map (valid only while locked)
-
- char* frameBaseAddr; // base address of pixel data (valid only while locked)
- unsigned long frameRowBytes; // number of bytes in a row of the frame
- short leftAlignFactor; // used to align the rect.left to the nearest long word
- short rightAlignFactor; // used to align the rect.right to the nearest long word
- Boolean isFrameLocked; // has the frame been locked?
-
- Rect frameRect; // source image rectangle
- Point offsetPoint; // image offset factor relative to destination rectangle
- RgnHandle maskRgn; // image masking region
- Boolean tileMaskIsSolid; // used by SWDrawTilesAboveSprite
-
- GWorldPtr maskPort; // GWorld for the mask image
- PixMapHandle maskPixHndl; // handle to pix map (saved for unlocking/locking)
- PixMapPtr maskPix; // pointer to color pix map (valid only while locked)
-
- char* maskBaseAddr; // base address of mask pixel data (valid only while locked)
-
- Boolean sharesGWorld; // shares GWorld with other frames
-
- unsigned short useCount; // number of sprites using this frame
-
- unsigned short numScanLines;
- short worldRectOffset; // non-whole-byte offset for 1-bit blitter
- unsigned long* scanLinePtrArray; // array of pointers to each scanline
-
- PixelCodeHdl pixCodeH; // handle to compiled sprite data
- BlitFuncPtr frameBlitterP; // procPtr to compiled sprite data
- };
-
-
- ///--------------------------------------------------------------------------------------
- // frame flags constants
- ///--------------------------------------------------------------------------------------
-
- typedef enum
- {
- kNoMask = 0,
- kPixelMask = 1,
- kRegionMask = 2,
- kFatMask = (kPixelMask + kRegionMask),
- kSolidMask = 4
- } MaskType;
-
-
- ///--------------------------------------------------------------------------------------
- // frame function prototypes
- ///--------------------------------------------------------------------------------------
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- SW_FUNC OSErr SWCreateWindowFrame(
- FramePtr* newFrameP,
- Rect* frameRect);
-
- SW_FUNC OSErr SWCreateFrameFromCicnResource(
- SpriteWorldPtr destSpriteWorld,
- FramePtr* newFrameP,
- short iconResID,
- MaskType maskType);
-
- SW_FUNC OSErr SWCreateFrameFromPictResource(
- SpriteWorldPtr destSpriteWorld,
- FramePtr* newFrameP,
- short pictResID,
- short maskResID,
- MaskType maskType);
-
- SW_FUNC OSErr SWCreateFrameFromGWorldAndRectStart(
- GWorldPtr *tempMaskGWorld,
- int maxWidth,
- int maxHeight);
-
- SW_FUNC void SWCreateFrameFromGWorldAndRectFinish(
- GWorldPtr tempMaskGWorld);
-
- SW_FUNC OSErr SWCreateFrameFromGWorldAndRectPartial(
- FramePtr* newFrameP,
- GWorldPtr pictGWorld,
- GWorldPtr maskGWorld,
- GWorldPtr tempMaskGWorld,
- Rect* frameRect,
- MaskType maskType);
-
- SW_FUNC OSErr SWCreateFrameFromGWorldAndRect(
- FramePtr* newFrameP,
- GWorldPtr pictGWorld,
- GWorldPtr maskGWorld,
- Rect* frameRect,
- MaskType maskType);
-
- SW_FUNC OSErr SWCreateFrame(
- GDHandle theGDH,
- FramePtr* newFrameP,
- Rect* frameRect);
-
- SW_FUNC OSErr SWCreateFrameFromDepth(
- FramePtr* newFrameP,
- short depth,
- Rect* frameRect);
-
- SW_FUNC OSErr SWCloneFrame(
- FramePtr cloneFrameP,
- FramePtr* newFrameP);
-
- SW_FUNC void SWInitializeFrame(
- FramePtr tempFrameP,
- short depth);
-
- SW_FUNC Boolean SWDisposeFrame(
- FramePtr oldFrameP);
-
- SW_FUNC void SWSetFrameMaskRgn(
- FramePtr srcFrameP,
- RgnHandle maskRgn);
-
- SW_FUNC void SWLockFrame(
- FramePtr srcFrameP);
-
- SW_FUNC void SWUnlockFrame(
- FramePtr srcFrameP);
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #endif /* __SPRITEFRAME__ */